package com.d0331;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.util.Scanner;

public class Score {
    public static void main(String[] args) {
        try {
            FileWriter fw = new FileWriter("D:/student.txt");
            BufferedWriter bw = new BufferedWriter(fw);
            Scanner sc = new Scanner(System.in);
            for(int i = 0; i < 5; i++) {
                System.out.println("请输入学生的学号 姓名 三门课的成绩 （以空格分割）");
                String str = sc.nextLine();
                String[] strs = str.split(" ");
                int sum = 0;
                for (int j = 2; j < 5; j++) {
                    sum += Integer.parseInt(strs[j]);
                }
                double avg = sum / 3.0;
                bw.write(str);
                bw.write(" " + avg);
                bw.newLine();
                bw.flush();
            }
            bw.close();
            fw.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
